package main

import "fmt"

/*
   @Time : 2018/9/3 16:27 
   @Author : ff

   双向输出内容
*/

var s chan string

func main() {
	s = make(chan string)
	go Pingpong()
	for i := 0;i < 10; i++ {
		s<-fmt.Sprintf("from mail id=%d",i)
		fmt.Println(<-s)
	}

}

func Pingpong()  {
	i := 0
	for {
		fmt.Println(<-s)
		s<-fmt.Sprintf("From client id=#%d",i)
		i++
	}
}
